package mofei.concurrent.task;

/**
 * @author mofei@staff.weibo.com
 * @date 2019/2/22 2:15 PM
 */
public class BlockedTask2 implements Runnable {
    @Override
    public void run() {
        synchronized(BlockedTask1.mutex2){
            System.out.println("获取mutex2的锁，现在进入休眠");
            try {
                Thread.sleep(5*1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("mutex2,结束休眠");
            synchronized (BlockedTask1.mutex1){
                System.out.println("成功获取mutex1的锁");
            }
        }
    }
}
